package com.nbjtjc.safe.mapper.safe;

import com.nbjtjc.safe.model.safe.RiskPointItem;
import com.nbjtjc.util.MyMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RiskPointItemMapper extends MyMapper<RiskPointItem> {

    @Delete("delete from risk_point_item where risk_point_id=#{riskPointId}")
    int deleteByRiskPointId(@Param("riskPointId") int riskPointId);

    @Select("select * from risk_point_item where risk_point_id=#{riskPointId} order by item_order asc ")
    List<RiskPointItem> findByRiskPointId(@Param("riskPointId") Integer riskPointId);

    @Select("select count(*) from risk_point_item where risk_point_id =#{pointId}")
    int countItemByPointId(@Param("pointId") int pointId);

    List<RiskPointItem> search(@Param("rpi")RiskPointItem riskPointItem);
}